Copyright ã1995 by NeXT Computer, Inc.  All Rights Reserved.

NS_DEV_DOCFOR:objc_class:ScrollView;,ScrollView

Inherits From:	View : Responder : Object

Declared In:	appkit/ScrollView.h

Class Description

A ScrollView object lets the user interact with a document that's too large to be shown in its entirety within a View and must therefore be scrolled.  The responsibility of a ScrollView is to coordinate scrolling behavior between Scroller objects and a ClipView object.  Thus, the user may drag the knob of a Scroller and the ScrollView will send a message to its ClipView to ensure that the viewed portion of the document reflects the position of the knob.  Similarly, the application can change the viewed position within a document and the ScrollView will send a message to the Scrollers advising them of this change.

The ScrollView has at least one subview (a ClipView object), which is called the content view.  The content view in turn has a subview called the document view, which is the view to be scrolled.  When a ScrollView is created, it has neither a vertical nor a horizontal scroller.  If Scrollers are required, the application must send setVertScrollerRequired:YES and setHorizScrollerRequired:YES messages to the ScrollView; the content view is resized to fill the area of the ScrollView not occupied by the Scrollers.  

When the application modifies the scroll position within the document, it should send a reflectScroll: message to the ScrollView, which will then query the content view and set the Scroller(s) accordingly.  The reflectScroll: message may also cause the ScrollView to enable or disable the Scrollers as required.

Instance Variables

id vScroller;

id hScroller;

id contentView;

float pageContext;

float lineAmount;

vScroller 	The vertical scroller.

hScroller 	The horizontal scroller.

contentView 	The content view.

pageContext 	The amount from the previous page remaining in the content view after a page scroll.

lineAmount 	The number of units to scroll for a line scroll.

Method Types

Initializing a ScrollView	- initFrame:

Determining component sizes	- getContentSize: 
- getDocVisibleRect:

Laying out the ScrollView	+ getContentSize:forFrameSize:horizScroller: vertScroller:borderType: 
+ getFrameSize:forContentSize:horizScroller: vertScroller:borderType: 
- resizeSubviews: 
- setHorizScrollerRequired: 
- setVertScrollerRequired: 
- tile

Managing component Views	- setDocView:
- docView
- setHorizScroller:
- horizScroller
- setVertScroller:
- vertScroller
- reflectScroll:

Modifying graphic attributes	- setBorderType:
- borderType
- setBackgroundGray: 
- backgroundGray
- setBackgroundColor:
- backgroundColor

Setting scrolling behavior	- setCopyOnScroll: 
- setDisplayOnScroll: 
- setDynamicScrolling: 
- setLineScroll: 
- setPageScroll:

Displaying	- drawSelf::

Managing the cursor	- setDocCursor:

Archiving	- read: 
- write:

Class Methods

NS_DEV_DOCFOR:objc_method:[ScrollView-getContentSize:forFrameSize:horizScroller:vertScroller:borderType:];,getContentSize:forFrameSize:horizScroller:vertScroller:borderType:

+ getContentSize:(NXSize *)cSize
forFrameSize:(const NXSize *)fSize
horizScroller:(BOOL)hFlag
vertScroller:(BOOL)vFlag
borderType:(int)aType

Calculates the size of a content view for a ScrollView with frame size fSize.  hFlag is YES if the ScrollView has a horizontal scroller, and vFlag is YES if it has a vertical scroller.  aType indicates whether there's a line, a bezel, or no border around the frame of the ScrollView, and is NX_LINE, NX_BEZEL, or NX_NOBORDER.  The content view size is placed in the structure specified by csize.  If the ScrollView object already exists, you can send it a getContentSize: message to get the size of its content view.  Returns self.

See also:  + getFrameSize:forContentSize:..., - getContentSize:

NS_DEV_DOCFOR:objc_method:[ScrollView-getFrameSize:forContentSize:horizScroller:vertScroller:borderType:];,getFrameSize:forContentSize:horizScroller:vertScroller:borderType:

+ getFrameSize:(NXSize *)fSize
forContentSize:(const NXSize *)cSize
horizScroller:(BOOL)hFlag
vertScroller:(BOOL)vFlag
borderType:(int)aType

Calculates the size of the frame required for a ScrollView with a content view size cSize.  The calculated frame size is placed in the structure specified by fSize.  hFlag is YES if the ScrollView has a horizontal scroller, and vFlag is YES if it has a vertical scroller.  aType indicates whether there's a line, a bezel, or no border around the frame of the ScrollView, and is NX_LINE, NX_BEZEL, or NX_NOBORDER.  Returns self.

See also:  + getContentSize:forFrameSize:..., - getContentSize:

Instance Methods

NS_DEV_DOCFOR:objc_method:[ScrollView-backgroundColor];,backgroundColor

- (NXColor)backgroundColor

Returns the color of the content view's background.  

See also:  - setBackgroundColor:, - backgroundGray, - backgroundColor (ClipView)

NS_DEV_DOCFOR:objc_method:[ScrollView-backgroundGray];,backgroundGray

- (float)backgroundGray

Returns the gray value of the content view's background.  

See also:  - setBackgroundGray:, - backgroundColor, - backgroundGray (ClipView)

NS_DEV_DOCFOR:objc_method:[ScrollView-borderType];,borderType

- (int)borderType

Returns a value that represents the type of border surrounding the ScrollView, one of NX_NOBORDER, NX_LINE, NX_BEZEL, or NX_GROOVE.  

See also:  - setBorderType:

NS_DEV_DOCFOR:objc_method:[ScrollView-docView];,docView

- docView

Returns the current document view.

See also:  - setDocView:, - docView (ClipView)

NS_DEV_DOCFOR:objc_method:[ScrollView-drawSelf::];,drawSelf::

- drawSelf:(const NXRect *)rects :(int)rectCount

Draws the ScrollView, but not its subviews.   Returns self.

See also:  - borderType, - display::: (View)

NS_DEV_DOCFOR:objc_method:[ScrollView-getContentSize:];,getContentSize:

- getContentSize:(NXSize *)theSize

Places the size of the ScrollView's content view in the structure specified by theSize.  theSize is specified in the coordinates of the ScrollView's superview.  Returns self.

See also:  + getContentSize:forFrameSize:horizScroller:vertScroller:borderType:

NS_DEV_DOCFOR:objc_method:[ScrollView-getDocVisibleRect:];,getDocVisibleRect:

- getDocVisibleRect:(NXRect *)aRect

Gets the visible portion of the document view by forwarding this message to the content view.  Returns the value returned by the forwarded message.

See also:  - getDocVisibleRect: (ClipView), - getVisibleRect: (View)

NS_DEV_DOCFOR:objc_method:[ScrollView-horizScroller];,horizScroller

- horizScroller

Returns the horizontal scroller, a Scroller object.  

See also:  - vertScroller

NS_DEV_DOCFOR:objc_method:[ScrollView-initFrame:];,initFrame:

- initFrame:(const NXRect *)frameRect

Initializes the ScrollView.  The ScrollView's frame rectangle is made equivalent to that pointed to by frameRect, which is expressed in the ScrollView's superview's coordinates.  This method installs a ClipView as the content view.  Clipping is turned off (the ScrollView relies on the content view for clipping), opacity is set to YES, and autoresizing is set to YES.  When created, the ScrollView has no Scrollers, and its content view fills its bounds rectangle.  This method is the designated initializer for the ScrollView class, and can be used to initialize a ScrollView allocated from your own zone.  Returns self.

See also:  - setHorizScrollerRequired:, - setVertScrollerRequired:, - setLineScroll:, - setPageScroll:

NS_DEV_DOCFOR:objc_method:[ScrollView-read:];,read:

- read:(NXTypedStream *)stream

Reads the ScrollView from the typed stream stream.  This method reads the ScrollView, its scrollers, and its content view, which in turn causes the content view's document view to be read.  Returns self.

See also:  - write:

NS_DEV_DOCFOR:objc_method:[ScrollView-reflectScroll:];,reflectScroll:

- reflectScroll:cView

Moves, resizes, or disables the Scrollers when the document is autoscrolled or changes size.   Returns self.

NS_DEV_DOCFOR:objc_method:[ScrollView-resizeSubviews:];,resizeSubviews:

- resizeSubviews:(const NXSize *)oldSize

Overrides View's resizeSubviews: to retile the ScrollView.  This method is invoked when the ScrollView receives a sizeTo:: message.  Returns self.

See also:  - tile

NS_DEV_DOCFOR:objc_method:[ScrollView-setBackgroundColor:];,setBackgroundColor:

- setBackgroundColor:(NXColor)color

Sets the color of the content view's background.  This color is used to paint areas inside the content view that aren't covered by the document view.  Returns the content view.

See also:  - backgroundColor, - setBackgroundGray:, - setBackgroundColor: (ClipView)

NS_DEV_DOCFOR:objc_method:[ScrollView-setBackgroundGray:];,setBackgroundGray:

- setBackgroundGray:(float)value

Sets the gray value of the content view's background.  This gray is used to paint areas inside of the content view that aren't covered by the document view.  Returns the content view.

See also:  - backgroundGray, - setBackgroundColor:, - setBackgroundGray: (ClipView)

NS_DEV_DOCFOR:objc_method:[ScrollView-setBorderType:];,setBorderType:

- setBorderType:(int)aType

Determines the border type of the ScrollView.  aType must be NX_NOBORDER, NX_LINE, or NX_BEZEL.  The default is NX_NOBORDER.  Returns self.

See also:  - borderType

NS_DEV_DOCFOR:objc_method:[ScrollView-setCopyOnScroll:];,setCopyOnScroll:

- setCopyOnScroll:(BOOL)flag

Determines whether the bits on the screen will be copied when scrolling occurs.  This method simply invokes (and returns the value returned by) the content view's setCopyOnScroll: method.

See also:  - setCopyOnScroll: (ClipView)

NS_DEV_DOCFOR:objc_method:[ScrollView-setDisplayOnScroll:];,setDisplayOnScroll:

- setDisplayOnScroll:(BOOL)flag

Determines whether the results of scrolling will be immediately displayed.  This method simply invokes (and returns the value returned by) the content view's setDisplayOnScroll: method.

See also:  - setDisplayOnScroll: (ClipView), - display (View), - invalidate (View)

NS_DEV_DOCFOR:objc_method:[ScrollView-setDocCursor:];,setDocCursor:

- setDocCursor:anObj

Sets the cursor to be used inside the content view.  Returns the old cursor.

See also:  - setDocCursor: (ClipView)

NS_DEV_DOCFOR:objc_method:[ScrollView-setDocView:];,setDocView:

- setDocView:aView

Attaches the document view.  Returns the old document view, or nil if there was none.

See also:  - docView, - setDocView: (ClipView)

NS_DEV_DOCFOR:objc_method:[ScrollView-setDynamicScrolling:];,setDynamicScrolling:

- setDynamicScrolling:(BOOL)flag

Determines whether dragging a scroller's knob will result in dynamic redisplay of the document.  If flag is YES, scrolling will occur as the knob is dragged.  If flag is NO, scrolling will occur only after the knob is released.  By default, scrolling occurs as the knob is dragged.  Returns self.

NS_DEV_DOCFOR:objc_method:[ScrollView-setHorizScroller:];,setHorizScroller:

- setHorizScroller:anObject

Sets the horizontal scroller to anObject (which should be an instance of a subclass of Scroller).  This method sets the target of anObject to the ScrollView and sets anObject's action to the ScrollView's private method that responds to the Scrollers and invokes the appropriate scrolling behavior.  To make the scroller visible, you must send a setHorizScrollerRequired:YES message to the ScrollView.  Returns the old scroller.

See also:  - setVertScroller:

NS_DEV_DOCFOR:objc_method:[ScrollView-setHorizScrollerRequired:];,setHorizScrollerRequired:

- setHorizScrollerRequired:(BOOL)flag

Adds or removes a horizontal scroller for the ScrollView.  If flag is YES, the ScrollView creates a new Scroller and shrinks its other subviews to accommodate it.  If flag is NO, the Scroller is removed from the ScrollView and the other subviews are resized to fill the ScrollView.  When a ScrollView is created, it doesn't have a horizontal scroller.  Once a Scroller is added, it will be enabled and disabled automatically by the ScrollView.  This method retiles and redisplays the ScrollView.  Returns self.

See also:  - tile

NS_DEV_DOCFOR:objc_method:[ScrollView-setLineScroll:];,setLineScroll:

- setLineScroll:(float)value

Sets the amount to scroll the document view when the ScrollView receives a message to scroll one line.  value is expressed in the content view's coordinates.  Returns self.

See also:  - setPageScroll:

NS_DEV_DOCFOR:objc_method:[ScrollView-setPageScroll:];,setPageScroll:

- setPageScroll:(float)value

Sets the amount to scroll the document view when the ScrollView receives a message to scroll one page.  value is the amount common to the content view before and after the page scroll and is expressed in the content view's coordinates.  Therefore, setting value to 0.0 implies that the entire content view is replaced when a page scroll occurs.  Returns self.

See also:  - setLineScroll:

NS_DEV_DOCFOR:objc_method:[ScrollView-setVertScroller:];,setVertScroller:

- setVertScroller:anObject

Sets the vertical scroller to anObject (which should be an instance of a subclass of Scroller).  This method sets the target of anObject to the ScrollView and sets anObject's action to the ScrollView's private method that responds to the Scrollers and invokes the appropriate scrolling behavior.  To make the scroller visible, you must send a setVertScrollerRequired:YES message to the ScrollView.  Returns the old scroller.

See also:  - setHorizScroller:

NS_DEV_DOCFOR:objc_method:[ScrollView-setVertScrollerRequired:];,setVertScrollerRequired:

- setVertScrollerRequired:(BOOL)flag

Adds or removes a vertical scroller to the ScrollView.  If flag is YES, the ScrollView creates a new Scroller and shrinks its other subviews to accommodate it.  If flag is NO, the Scroller is removed from the ScrollView and the other subviews are resized to fill the ScrollView.  When a ScrollView is created, it doesn't have a vertical scroller.  Once a Scroller is added, it will be enabled and disabled automatically by the ScrollView.  This method retiles and redisplays the ScrollView.  Returns self.

See also:  - tile

NS_DEV_DOCFOR:objc_method:[ScrollView-tile];,tile

- tile

Determines the layout of the ScrollView by setting the sizes and locations of the object's subviews.  You rarely send a tile message directly; you may override it if you need to have the ScrollView manage additional views.  A tile message is sent whenever the ScrollView is resized, or a vertical or horizontal scroller is added or removed.  This method doesn't  redisplay the ScrollView.  Returns self.

See also:  - setVertScrollerRequired:, - setHorizScrollerRequired:, - resizeSubviews:

NS_DEV_DOCFOR:objc_method:[ScrollView-vertScroller];,vertScroller

- vertScroller

Returns the vertical scroller, a Scroller object.

See also:  - horizScroller

NS_DEV_DOCFOR:objc_method:[ScrollView-write:];,write:

- write:(NXTypedStream *)stream

Writes the ScrollView to the typed stream stream.  This method writes the ScrollView, its scrollers, and its content view, which in turn causes the content view's document view to be written.  Returns self.

See also:  - read: